#include "Entity.h"

Entity::Entity() {
    Initialize();
}

Entity::Entity(Image& image) {
    Initialize();
    SetImage(image);
}

Entity::~Entity() {
}

void Entity::Initialize() {
    // void Setup( float x, float y, float w, float h )
    coord.Setup(0, 0, 32, 48);
    /*
    ToDo: Here's a problem- I should be able to set the image from
    within the initialization function, but cannot, as it is in the
    image manager.  It will have to be called from main.
     */
}

/**
 * Entity::UpdateSprite
 * Makes sure the sprite is in the appropriate location
 */
void Entity::UpdateSprite() {
    sprite.SetPosition(coord.x, coord.y);

}

/**
 * Entity::GetSprite
 * Updates and then returns the sprite for an external object to draw
 * @return sprite Sprite     Returns this entity's image sprite
 */
Sprite& Entity::GetSprite() {
    UpdateSprite();

    return sprite;
}

/**
 * Entity::SetImage
 * Wrapper for the entity object's Sprite object
 * @param image Image      Image object that this entity will be set to
 */
void Entity::SetImage(Image& image) {
    sprite.SetImage(image);
    sprite.SetSubRect(sf::IntRect(0, 0, 32, 48));
}

